#region Copyright
/// <copyright>
/// Copyright (c) 2007 Ilia Shramko.
/// Released under the terms of the GNU General Public License.
/// </copyright>
#endregion

using System;

namespace Osh.Dvb
{
	/// <summary>
	/// Summary description for ServiceInformationSection.
	/// </summary>
	public class ServiceInformationSection
	{
		private byte _tableId;
		private ushort _bodyLength;
		protected int _crc32;
		private const int MinSectionSize = 8 + 2 + 4;

		public ServiceInformationSection(PacketBinaryReader reader)
		{
			_tableId = reader.ReadByte();
			_bodyLength = (ushort)(reader.ReadUInt16BE() & 0xFFF);
			_crc32 = 0;
		}

		protected void ReadCrc32(PacketBinaryReader reader)
		{
			_crc32 = (int)reader.ReadUInt32BE();
		}

		public byte TableId
		{
			get { return _tableId; }
		}
		public int Length
		{
			get { return HeaderLength + BodyLength; }
		}
		public int HeaderLength
		{
			get { return 3; }
		}
		public int BodyLength
		{
			get { return _bodyLength; }
		}
		public int Crc32
		{
			get { return _crc32; }
		}


	}
}
